<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------
namespace app\user_center\behavior\user\focus_user_before;

/**
 * 检测是否关注
 * @package app\user_center\behavior\user
 * @author shiqiang
 */
class checkFocusLogic{
    /**
     * 执行行为 run方法是Behavior唯一的接口
     * @access public
     * @return void
     */
    public function run($params){
		$uid 			= $params['uid'];
		$follow_uid 	= $params['follow_uid'];
		$follow_type 	= $params['follow_type'];
		
		if($uid == $follow_uid){
			return array_out(-1001,'不能关注自己');
		}
		
		//查询是否关注
		$result = model('UcMemberFollow', 'model\user') -> getDataByFollow($uid, $follow_uid);
		
		if($follow_type == 1 && $result['code'] > 0){
			return array_out(-1001,'已经关注');
		}
		if($follow_type == 2 && $result['code'] < 0){
			return array_out(-1001,'取关失败');
		}
    }
}
